//***************************************//
//**        mCalc 26122011             **//
//**   Riku Maikola rpm@ac-mapa.org    **//
// **************************************//
#ifndef __mMath__
#define __mMath__

#define PI 3.1415926535897932385
#define TAU 6.2831853071795864769
#define DegToRad 0.017453293
#define RadToDeg 57.2957795

#include <cmath>

//Mathfunctions...
double tb_CircleArea(double);       //...
double Bisector(double,double);
double Distance2D(double,double,double,double);
double Distance3D(double,double,double,double,double,double);

//Cuttingdata.cpp
//rev/min
double cd_rpm(double Vc,double Dc);                     //outputs rev/min
double cd_rpmForCopying(double Vc,double Dc,double Ap); //
double cd_CuttingSpeed(double n,double Dc);             //Outputs Vc
double cd_FeedSpeed(double n,double Zc,double Fz);      //Outputs Vf....feed (mm/min)
double cd_FeedPerRevolution(double Zn,double Zc);       //f

//interpolation
double cd_InternalCircularInterpolation(double Do,double Di,double Dc);  //Ae...
double cd_ExternalCircularInterpolation(double Do,double Di,double Dc);  //Ae...
double cd_FeedSpeedInterpolationInternal(double Do,double Dc,double n,double Zc,double Fz); //Vf
double cd_FeedSpeedInterpolationExternal(double Di,double Dc,double n,double Zc,double Fz); //V

//doubles measurments
bool AER(double A, double B, double maxRelativeError=0.0001);
bool IsInArc(double a1,double a2,double sel);  //always ccw a1->a2
#endif
